# block some bogus URLs
# URLs of the following forms are blocked by the server.n
nophp {
    block /*.php
}
nowmv {
    block /*.wmv
}
noexe {
    block /*.exe
}
nocgi {
    block /cgi-bin/
}
noasp {
    block /*.asp
}

icons {
    domain Icons
    url /_icons/
}

jquery {
    domain JQ
    url /_jquery/
}

stats {
    domain File
    url /_stats/
    root /var/www/webalizer
}

nubs {
    domain Nub
    url /_nub/
    docurl /_wub/docs/
}

domain wub {
    domain Mason
    url /_wub/
    root $docroot
}

domain about {
    url /_wub/docs/
    domain About
}

# Useful static content directories
css {
    domain File
    url /_css/
    root [file join $docroot css]
    expires "next week"
}

images {
    domain File
    url /_images/
    root [file join $docroot images]
    expires "next week"
}

scripts {
    domain File
    url /_scripts/
    root [file join $docroot scripts]
    expires "next week"
}

html {
    domain File
    url /_html/
    root [file join $docroot html]
}

bin {
    domain File
    url /_bin/
    root [file join $docroot bin]
}

#tiny {
#    domain Tiny
#    url /_tiny/
#    file tiny.mk
#}

recaptcha {
    domain ReCAPTCHA
    url /rc/
    public "<your recaptcha public key here>"
    private "<your recaptcha private key here>"
}

welcome {
    url /_/welcome	;# need to silently redirect welcome page
    rewrite {^//[^/]+/$}
}

icorewrite {
    url {^//[^/]+/[^/]+[.](jpg|gif|png|ico)$}
    rewrite {/_images/[Url tail [dict get $r -path]]}
}

cssrewrite {
    url {^//[^/]+/[^/]+[.]css}
    rewrite {/_css/[Url tail [dict get $r -path]]}
}

cssrewrite1 {
    url {/css/[^/]+[.]css}
    rewrite {/_css/[Url tail [dict get $r -path]]}
}

binrewrite {
    url {^//.+/[^/]+[.]gz}
    rewrite {/_bin/[Url tail [dict get $r -path]]}
}

scriptrewrite {
    url {^//[^/]+/[^/]+[.]js}
    rewrite {/_scripts/[Url tail [dict get $r -path]]}
}

docrewrite {
    url {/doc/.*}
    rewrite {/_docs/[Url range [dict get $r -path] 2 end]}
}

nubrewrite {
    url {/nub/.*}
    rewrite {/_nub/[Url range [dict get $r -path] 2 end]}
}

sitemap {
    url {/_sitemap.xml}
    rewrite {/_/sitemap}
}

sitemap1 {
    url {/_sitemap}
    rewrite {/_/sitemap}
}

robots {
    url /robots.txt
    literal {User-agent: *
	Sitemap: http://wiki.tcl.tk/_sitemap.xml
	Disallow: /2
	Disallow: /5.html
	Disallow: /_/
	Disallow: /_edit/
	Disallow: /_ref/
	Disallow: /_summary/
	Disallow: /_diff/
	Disallow: /_search/
	Disallow: /_history/
	Disallow: /_repo/
	Disallow: /_stats/
	
	User-agent: Twiceler
	Disallow: /

	User-agent: MJ12bot
	Disallow: /
    }
    mime text/plain
}

rss {
    url /rss.xml
    code {
	# return [Http NotFound $r "RSS Feed Temporarily Offline"]
	# generate and return RSS feed
	return [Http CacheableContent $r [clock seconds] [WikitRss rss] application/rss+xml]
    }
}

wikitwub {
    domain WikitWub
    url /_/	;# handle direct domain within WikitWub
    base [pwd]
    pageURL /
    perms {admin {admin admin}}
    full_text_search 0
}

default {
    url default
    code {
	set r [::WikitWub do $r]
	dict get $r -content
    }
}
